import React from 'react'
import { useState } from 'react'
import { Navigate } from 'react-router-dom'
type Props = {}

export default function Detail({ }: Props) {
    const [num, setnum] = useState(0)
    return (
        <div>
            <p>Detail页面</p>
            <p onClick={() => {
                setnum(num + 1)
            }}>num:{num}</p>
            {/* 当num的值为5的时候, 就跳转到home页 */}
            {
                num == 5 ? <Navigate to='/home'></Navigate> : <></>
            }
        </div>
    )
}